﻿// -------------------------------------------------------
// BeautyTips default options
// -------------------------------------------------------

var defaultSlideSpeed = 300;

var defaultTipOptions = {
	padding: 8,
	width: 230,
	spikeLength: 30,
	spikeGirth: 20,
	cornerRadius: 8,
	fill: "rgba(242,242,242, .92)",
	shadow: true,
	shadowOffsetX: 2,
	shadowOffsetY: 2,
	shadowBlur: 10,
	shadowColor: "rgba(5,5,5, .52)",
	shadowOverlap: false,
	strokeWidth: 1,
	strokeStyle: "#999999",
	hoverIntentOpts: { interval: 200, timeout: 0 }
};

// -------------------------------------------------------
// Search Modal
// -------------------------------------------------------

function SearchItemBySerial()
{
	var serial = $("[id$='_TxtSearchSerial']").val();

	jQuery.fn.colorbox({ href: "BoxSearch.aspx?serial=" + serial, title: serial, width: "55%", height: "550px", iframe: true });
}

// -------------------------------------------------------
// My Bikes
// -------------------------------------------------------

function MyBikes_ComboChanged(obj)
{
	document.location = "/MyBikes.aspx?bike=" + obj.options[obj.selectedIndex].value;
}

function MyBikes_PictureUploadStarted(sender, args)
{
	var filename = args.get_fileName();
	var ext = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();

	if (ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "png" || ext == "bmp")
	{
		return true;
	}
	else
	{
		args.set_cancel(true);
		args.set_errorMessage("JPG GIF PNG BMP");

		return false;
	}
}

function MyBikes_PictureUploadComplete(sender, args)
{
	var dt = new Date();

	$("[id$='_ImgBikePicture']").attr("src", $("[id$='ImgBikePicture']").attr("src") + "?" + dt.getDate());

	var id = $("[id$='_UplBikePicture']").attr("id");
	var up = document.getElementById(id);
	var txts = up.getElementsByTagName("input");
	
	for (var i = 0; i < txts.length; i++)
	{
		if (txts[i].type == "text" || txts[i].type == "file")
		{
			txts[i].value = "";
			txts[i].style.backgroundColor = "";
		}
	}
}

function AddNote_ChangeStatus(obj)
{
	var status = obj.options[obj.selectedIndex].value;

	$("#ImgNoteSelectedStatus").attr("src", "/Images/Ico/Status" + status + "_24.png");
}

// -------------------------------------------------------
// Black Markets
// -------------------------------------------------------

function suggestBlackMarket()
{
}